function showHideAlert(alertText, event)
{
	if(BrowserDetect.browser == 'Explorer' && BrowserDetect.version < '7') {
		alert(alertText);
	} else {
		var alertOverlay = document.getElementById('overlay');
		var alertDiv = document.getElementById('alert');
		var wp = pw();
		if (alertDiv.style.display == 'block') {
			alertOverlay.style.display = 'none';
			alertDiv.style.display = 'none';
		} else {
			if (alertText) {
				var alertDivText = document.getElementById('alertText');
				alertDivText.innerHTML = alertText;
			}
			
			if(event != null) {
				tv = mouseY(event) - 142;
				lv = mouseX(event) - (alertDiv.offsetWidth/4) - 175;
			} else {
				if (window.innerWidth || window.innerHeight){ 
					docwidth = window.innerWidth; 
					docheight = window.innerHeight; 
				} 
				//IE Mozilla 
				if (document.body.clientWidth || document.body.clientHeight){ 
					docwidth = document.body.clientWidth; 
					docheight = document.body.clientHeight; 
				} 
				tv = docheight/2 + 142;
				lv = docwidth/2 - (alertDiv.offsetWidth/4) - 175;
			}
			if (lv < 2)
				lv = 2;
			else if (lv + alertDiv.offsetWidth > wp) 
				lv -= alertDiv.offsetWidth/2;
			lv += 'px';
			tv += 'px';
			alertDiv.style.left = lv;
			alertDiv.style.top = tv;
			alertOverlay.style.display = 'block';
			alertDiv.style.display = 'block';
		}
	}
}

// Extended Tooltip Javascript
// copyright 9th August 2002, 3rd July 2005, 24th August 2008
// by Stephen Chapman, Felgall Pty Ltd
// permission is granted to use this javascript provided that the below code is not altered
function pw(){
	return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
}

function mouseX(evt){
	return evt.clientX ? evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : evt.pageX
}

function mouseY(evt){
	return evt.clientY ? evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : evt.pageY
}

function popUp(evt, oi){
	if (document.getElementById){
		var wp = pw()
		dm = document.getElementById(oi)
		ds = dm.style
		st = ds.visibility
		if (dm.offsetWidth) 
			ew = dm.offsetWidth
		else if (dm.clip.width) 
			ew = dm.clip.width
		if (st == "visible" || st == "show"){ 
			ds.visibility = "hidden"
		}else{
			tv = mouseY(evt) + 20
			lv = mouseX(evt) - (ew/4)
			if (lv < 2) lv = 2
			else if (lv + ew > wp) 
				lv -= ew/2
			lv += 'px'
			tv += 'px'
			ds.left = lv
			ds.top = tv
			ds.visibility = "visible"
		}
	}
}
